using System;
using System.Collections.Generic;
using System.Text;

namespace LibGreen.Jabber.ProtocolElements.IqElements
{
    /// <summary>
    /// Defines an &lt;iq&gt; element with the &lt;session&gt; subtype
    /// </summary>
    public sealed class IqSessionElement
    {
        /// <summary>
        /// The xmlns of the IQ &lt;session&gt; element
        /// </summary>
        private const string XMLNS = "urn:ietf:params:xml:ns:xmpp-session";

        /// <summary>
        /// Creates a new &lt;iq&gt;&lt;session /&gt;&lt;/iq&gt; stanza to establish a session with the server
        /// </summary>
        /// <returns>A new &lt;iq&gt; element</returns>
        public static Element Create()
        {
            Element parent = IqElement.Create(IqType.Set);
            Dictionary<string, string> sessionAttributes = new Dictionary<string, string>(2);
            sessionAttributes["xmlns"] = XMLNS;
            parent.Children.Add(Element.CreateElement("session", sessionAttributes));
            return parent;
        }
    }
}
